#include <iostream>
#include <vector>

#include "example.hpp"

int main() {
    std::cout << "=== C++ 项目模板示例 ===" << std::endl;
    std::cout << std::endl;

    // 使用Calculator类
    example::Calculator calc;

    std::cout << "Calculator 示例:" << std::endl;
    std::cout << "10 + 5 = " << calc.add(10, 5) << std::endl;
    std::cout << "10 - 5 = " << calc.subtract(10, 5) << std::endl;
    std::cout << "10 * 5 = " << calc.multiply(10, 5) << std::endl;
    std::cout << "10 / 5 = " << calc.divide(10.0, 5.0) << std::endl;

    std::vector<int> numbers = {1, 2, 3, 4, 5};
    std::cout << "数组 {1, 2, 3, 4, 5} 的和 = " << calc.sum(numbers) << std::endl;
    std::cout << std::endl;

    // 使用StringUtils类
    std::cout << "StringUtils 示例:" << std::endl;
    std::string text = "Hello World";
    std::cout << "原始字符串: " << text << std::endl;
    std::cout << "转大写: " << example::StringUtils::toUpper(text) << std::endl;
    std::cout << "转小写: " << example::StringUtils::toLower(text) << std::endl;

    std::string csv = "apple,banana,orange";
    std::cout << "分割字符串 '" << csv << "':" << std::endl;
    auto parts = example::StringUtils::split(csv, ',');
    for (const auto &part : parts) { std::cout << "  - " << part << std::endl; }

    std::string padded = "   trim me   ";
    std::cout << "去除空格 '" << padded << "' -> '" << example::StringUtils::trim(padded) << "'" << std::endl;

    return 0;
}
